/*
 * AbstractDescription.java
 *
 * Created on 16 de Junho de 2011, 18:09
 *
 */

package intopo.game;

import java.lang.reflect.Constructor;
import java.util.Map;
import java.util.Scanner;

/**
 * Provides attributes that represent the description of game.  This class
 * is abstract since we enforce the construction of instances via
 * specialised classes that supply the values for the unique constructor of class {@code AbstractDescription}.
 *
 * @param G The game players are going to play.
 * @param S The strategy used by players.
 *
 * @author <a href="mailto:mariano.pedro@gmail.com">Pedro Mariano</a>
 *
 * @version 1.0 16 de Junho de 2011
 */
abstract public class AbstractDescriptionText<G extends Game<S>, S extends Strategy<S>>
	implements DescriptionText<G, S>
{
	/**
	 * Map that associates strings to game constructors. These strings
	 * identify which particular implementation of game {@code G} should be
	 * used.  Different implementations may simulate all iterations of an
	 * iterated game. On the other hand, it may compute how some strategies
	 * would behave in a iterated game.
	 * 
	 */
	final private Map<String, Constructor<? extends G>> gameConstructors;
	/**
	 * Map that associates tag names to strategy constructors.
	 */
	final private Map<String, Constructor<? extends S>> strategyConstructors;
	/**
	 * Fold object that can be used to summarise a collection of strategies.
	 */
	final private FoldStrategy<S> foldStrategy;
	/**
	 * Sole constructor of this class.  It is protected since we enforce
	 * construction of instances via specialised classes.
	 *
	 * @param gameConstructors The associative memory with game
	 * constructors.
	 * @param strategyConstructors The associative memory with player's
	 * strategies.
	 * @param foldStrategy The strategy fold object.
	 */
	protected AbstractDescriptionText (Map<String, Constructor<? extends G>> gameConstructors, Map<String, Constructor<? extends S>> strategyConstructors, FoldStrategy<S> foldStrategy)
	{
		this.gameConstructors = gameConstructors;
		this.strategyConstructors = strategyConstructors;
		this.foldStrategy = foldStrategy;
	}
	@Override
	final public Map<String, Constructor<? extends G>> getGameConstructor ()
	{
		return this.gameConstructors;
	}
	final public Map<String, Constructor<? extends S>> getStrategyConstructors ()
	{
		return this.strategyConstructors;
	}
	final public FoldStrategy<S> getFoldStrategy ()
	{
		return this.foldStrategy;
	}
}

// Local Variables: 
// mode: java
// mode: flyspell-prog
// ispell-local-dictionary: "british"
// End:
